# import pymysql
# # 创建连接
#
# conn = pymysql.connect(host='localhost', user='root', password='root', port=3306,database='btsj', charset='utf8')
#
# # 创建游标
# cursor = conn.cursor()
# sql = "select * from customer_data limit 10"
# cursor.execute(sql)
# conn.commit()
# for i in cursor.fetchall():
#     print(i)
# cursor.close()
# conn.close()
import pymysql

conn = pymysql.connect(
    host='localhost',
    user='root',
    password='root',
    database='jiangsu'
)
cursor = conn.cursor()
# # 插入数据
# sql = 'insert into user(name,age) values(%s,%s)'
# data = ('lisi', 18)
# cursor.execute(sql, data)
# conn.commit()
# 查询数据
# sql='select * from user'
# cursor.execute(sql)
# rows=cursor.fetchall()
# for i in rows:
#     print(i)
# # 删除数据
# sql='delete from user where name="lisi"'
# cursor.execute(sql)
# conn.commit()
# cursor.close()
# 修改数据
# sql = 'update  user set name="chocolate" '
# cursor.execute(sql)
# conn.commit()
# cursor.close()